package cn.liyicun.cp.cpweb.mapper;

import cn.liyicun.cp.cpweb.entity.RechargeInfo;
import cn.liyicun.cp.cpweb.entity.RechargeInfoExample;
import java.io.Serializable;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.session.RowBounds;
import org.apache.ibatis.type.JdbcType;

@Mapper
public interface RechargeInfoMapper extends Serializable {
    @SelectProvider(type=RechargeInfoSqlProvider.class, method="countByExample")
    long countByExample(RechargeInfoExample example);

    @DeleteProvider(type=RechargeInfoSqlProvider.class, method="deleteByExample")
    int deleteByExample(RechargeInfoExample example);

    @Delete({
        "delete from recharge_info",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    @Insert({
        "insert into recharge_info (type, card_name, ",
        "card_no, card_link, ",
        "status, remark, ",
        "last_time)",
        "values (#{type,jdbcType=VARCHAR}, #{cardName,jdbcType=VARCHAR}, ",
        "#{cardNo,jdbcType=VARCHAR}, #{cardLink,jdbcType=VARCHAR}, ",
        "#{status,jdbcType=INTEGER}, #{remark,jdbcType=VARCHAR}, ",
        "#{lastTime,jdbcType=TIMESTAMP})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Long.class)
    int insert(RechargeInfo record);

    @InsertProvider(type=RechargeInfoSqlProvider.class, method="insertSelective")
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Long.class)
    int insertSelective(RechargeInfo record);

    @SelectProvider(type=RechargeInfoSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="type", property="type", jdbcType=JdbcType.VARCHAR),
        @Result(column="card_name", property="cardName", jdbcType=JdbcType.VARCHAR),
        @Result(column="card_no", property="cardNo", jdbcType=JdbcType.VARCHAR),
        @Result(column="card_link", property="cardLink", jdbcType=JdbcType.VARCHAR),
        @Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
        @Result(column="remark", property="remark", jdbcType=JdbcType.VARCHAR),
        @Result(column="last_time", property="lastTime", jdbcType=JdbcType.TIMESTAMP)
    })
    List<RechargeInfo> selectByExampleWithRowbounds(RechargeInfoExample example, RowBounds rowBounds);

    @SelectProvider(type=RechargeInfoSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="type", property="type", jdbcType=JdbcType.VARCHAR),
        @Result(column="card_name", property="cardName", jdbcType=JdbcType.VARCHAR),
        @Result(column="card_no", property="cardNo", jdbcType=JdbcType.VARCHAR),
        @Result(column="card_link", property="cardLink", jdbcType=JdbcType.VARCHAR),
        @Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
        @Result(column="remark", property="remark", jdbcType=JdbcType.VARCHAR),
        @Result(column="last_time", property="lastTime", jdbcType=JdbcType.TIMESTAMP)
    })
    List<RechargeInfo> selectByExample(RechargeInfoExample example);

    @Select({
        "select",
        "id, type, card_name, card_no, card_link, status, remark, last_time",
        "from recharge_info",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="type", property="type", jdbcType=JdbcType.VARCHAR),
        @Result(column="card_name", property="cardName", jdbcType=JdbcType.VARCHAR),
        @Result(column="card_no", property="cardNo", jdbcType=JdbcType.VARCHAR),
        @Result(column="card_link", property="cardLink", jdbcType=JdbcType.VARCHAR),
        @Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
        @Result(column="remark", property="remark", jdbcType=JdbcType.VARCHAR),
        @Result(column="last_time", property="lastTime", jdbcType=JdbcType.TIMESTAMP)
    })
    RechargeInfo selectByPrimaryKey(Long id);

    @UpdateProvider(type=RechargeInfoSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") RechargeInfo record, @Param("example") RechargeInfoExample example);

    @UpdateProvider(type=RechargeInfoSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") RechargeInfo record, @Param("example") RechargeInfoExample example);

    @UpdateProvider(type=RechargeInfoSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(RechargeInfo record);

    @Update({
        "update recharge_info",
        "set type = #{type,jdbcType=VARCHAR},",
          "card_name = #{cardName,jdbcType=VARCHAR},",
          "card_no = #{cardNo,jdbcType=VARCHAR},",
          "card_link = #{cardLink,jdbcType=VARCHAR},",
          "status = #{status,jdbcType=INTEGER},",
          "remark = #{remark,jdbcType=VARCHAR},",
          "last_time = #{lastTime,jdbcType=TIMESTAMP}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(RechargeInfo record);
}